﻿<%@ Page Title="" Language="C#" MasterPageFile="~/template/Admin.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="EmptyWallGallery.FrontEnd.inside.Editor.Articles.Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        $(function ($) {
            //$('#txtFromDay').datepicker({ format: "dd/mm/yyyy" });
            //$('#txtToDay').datepicker({ format: "dd/mm/yyyy" });

            var checkin = $('#txtFromDay').datepicker({
                format: "dd/mm/yyyy"
            }).on('changeDate', function (ev) {
                checkin.hide();
                $('#txtToDay')[0].focus();
            }).data('datepicker');

            var checkout = $('#txtToDay').datepicker({
                format: "dd/mm/yyyy"
            }).on('changeDate', function (ev) {
                checkout.hide();
            }).data('datepicker');

            $('input:radio, select.uniformselect').uniform();
            //var checkin = $('#txtFromDay').datepicker({
            //    onRender: function (date) {
            //        return date.valueOf() < now.valueOf() ? 'disabled' : '';
            //    }
            //}).on('changeDate', function (ev) {
            //    if (ev.date.valueOf() > checkout.date.valueOf()) {
            //        var newDate = new Date(ev.date);
            //        newDate.setDate(newDate.getDate() + 1);
            //        checkout.setValue(newDate);
            //    }
            //    checkin.hide();
            //    $('#txtToDay')[0].focus();
            //}).data('datepicker');

            //var checkout = $('#txtToDay').datepicker({
            //    format: "dd/mm/yyyy",
            //    onRender: function (date) {
            //        return date.valueOf() <= checkin.date.valueOf() ? 'disabled' : '';
            //    }
            //}).on('changeDate', function (ev) {
            //    checkout.hide();
            //}).data('datepicker');
        });
    </script>
    <style type="text/css">
        #uniform-drpStatus, #uniform-drpUser, #uniform-DropCategory { width: 210px; }
    </style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ctphTitle" runat="server">
    <h1>Tin tức</h1>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ctphMain" runat="server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div class="form-wrap">
                <div class="form-field">
                    <label>Tiêu đề:</label>
                    <asp:TextBox ID="txtTitle" runat="server"></asp:TextBox>
                </div>
                <div class="form-field">
                    <label>Danh mục:</label>
                    <asp:DropDownList ID="DropCategory" runat="server" CssClass="uniformselect" ClientIDMode="Static">
                    </asp:DropDownList>
                </div>
                <div class="form-field">
                    <label>Người đăng:</label>
                    <asp:DropDownList ID="drpUser" runat="server" CssClass="uniformselect" ClientIDMode="Static">
                    </asp:DropDownList>
                </div>
                <div class="form-field">
                    <label>Trạng thái:</label>
                    <asp:DropDownList ID="drpStatus" runat="server" CssClass="uniformselect" ClientIDMode="Static">
                        <asp:ListItem Value="0">Đã đăng</asp:ListItem>
                        <asp:ListItem Value="1">Chưa đăng</asp:ListItem>
                    </asp:DropDownList>
                </div>
                <%--<div class="form-field">
                    <label>Từ ngày:</label>
                    <asp:TextBox ID="txtFromDay" ClientIDMode="Static" runat="server"></asp:TextBox>
                </div>
                <div class="form-field">
                    <label>Đến ngày:</label>
                    <asp:TextBox ID="txtToDay" ClientIDMode="Static" runat="server"></asp:TextBox>
                </div>--%>
                <div class="clearfix"></div>
                <div class="form-field">
                    <p class="submitButton">
                        <asp:Button ID="BtnSearch" CssClass="btn btn-primary" runat="server" Text="Tìm kiếm" OnClick="BtnSearchClick" />
                    </p>
                </div>
            </div>

            <div class="full">
                <div id="dyntable_length" runat="server" class="dataTables_length"></div>

                <asp:GridView ID="grdListArticle" runat="server" AllowPaging="True"
                    AllowSorting="True" AutoGenerateColumns="False"
                    DataKeyNames="ArticlesID" PageSize="10" EmptyDataText="Không có bài viết nào"
                    CssClass="ze-section-grid" Style="border-collapse: separate;" border="0"
                    OnPageIndexChanging="GrdListArticlePageIndexChanging">
                    <Columns>
                        <asp:TemplateField HeaderText="STT" ItemStyle-Width="3%" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <%# Container.DataItemIndex + 1 %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Bài viết" ItemStyle-Width="40%">
                            <ItemTemplate>
                                <div onmouseover="javascript:Util.DisplayPostAction('PostAction_<%#Eval("ArticlesID")%>');" onmouseout="javascript:Util.HidePostAction('PostAction_<%#Eval("ArticlesID")%>');" style="height: 32px;">
                                    <a class="lnkArticle" href="ArticleUpdate.aspx?ID=<%#Eval("ArticlesID")%>&ReUrl=<%=Server.UrlEncode(Request.RawUrl) %>"><%#DisplayTitle(Eval("Title").ToString())%></a>
                                    <div class="PostAction" style="display: none;" id="PostAction_<%#Eval("ArticlesID")%>"><a href="ArticleUpdate.aspx?ID=<%#Eval("ArticlesID")%>&ReUrl=<%=Server.UrlEncode(Request.RawUrl) %>" title="Edit this Post">Sửa</a>&nbsp;|&nbsp;<a href="?action=Delete&ID=<%#Eval("ArticlesID")%>&ReUrl=<%=Server.UrlEncode(Request.RawUrl) %>" title="Delete this Post" onclick="javascript:return Util.ConfirmDeleteArticle('<%# Eval("Title") %>');">Xóa</a></div>
                                </div>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Danh mục" ItemStyle-Width="15%">
                            <ItemTemplate>
                                <%#DisplayCategory(Eval("ArticlesID").ToString())%>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Lượt xem" ItemStyle-Width="10%">
                            <ItemTemplate>
                                <%#Eval("ViewCount")%>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Người đăng" ItemStyle-Width="10%">
                            <ItemTemplate>
                                <%#Eval("UserName")%>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Ngày đăng" ItemStyle-Width="15%">
                            <ItemTemplate>
                                <%#DisplayStatusDate(Eval("Approved"), Eval("ReleaseDate").ToString())%>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <HeaderStyle CssClass="header" />
                    <PagerSettings Mode="NumericFirstLast" />
                    <PagerStyle CssClass="footer" Font-Size="14" />
                </asp:GridView>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
